package Operation;

import book.Booklist;
import book.Book;
import java.util.Scanner;

public class FindOperation implements IOperation{
    public void work(Booklist booklist) {
        System.out.println("查找图书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要查找的图书");
        String name =scanner.nextLine();
        int currentsize = booklist.getUsedSize();
        for (int i = 0; i <currentsize ; i++) {
            Book book =booklist.getBooks(i);
              if(book.getName().equals(name)){
                  System.out.println("找到了");
                  System.out.println(book);
                  return;
              }
            }
        System.out.println("没找到");
        }
    }

